package com.nativetalk.dao;

import com.nativetalk.bean.member.setmeal.TdNtMembSetmealDetail;
import com.nativetalk.bean.member.setmeal.TdNtMembSetmealInsert;
import com.nativetalk.bean.member.setmeal.TdNtMembSetmealList;
import com.nativetalk.bean.member.setmeal.TdNtMembSetmealState;
import com.nativetalk.bean.setmeal.TdNtSetMealIsTrial;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * Created by lizhun on 16/1/5.
 * Modified by wangzheng on 17/02/16
 */
@MyBatisRepository
public interface TdNtMembSetmealDao {
    /**
     * @Purpose  添加套餐
     * @version  1.0
     * @author   lizhun
     * @param    tdNtMembSetmealInsert
     * @return   void
     */
    public void inserttdNtMembSetmeal(TdNtMembSetmealInsert tdNtMembSetmealInsert);
    /**
     * @Purpose  根据用户id查找用户套餐信息数量
     * @version  1.0
     * @author   lizhun
     * @param    memb_id
     * @return   Integer
     */
    public Integer  findTdNtMembSetmealListSize(Integer memb_id);
    /**
     * @Purpose  根据用户id分页查找用户套餐信息
     * @version  1.0
     * @author   lizhun
     * @param    map
     * @return   List<TdNtMembSetmealList>
     */
    public List<TdNtMembSetmealList>  findTdNtMembSetmealListPage(Map<String,Object> map);
    /**
     * @Purpose  根据用户id查找用户套餐信息数量(已完成)
     * @version  1.0
     * @author   lizhun
     * @param    memb_id
     * @return   Integer
     */
    public Integer  findFinsihTdNtMembSetmealListSize(Integer memb_id);
    /**
     * @Purpose  根据用户id分页查找用户套餐信息(已完成)
     * @version  1.0
     * @author   lizhun
     * @param    map
     * @return   List<TdNtMembSetmealList>
     */
    public List<TdNtMembSetmealList>  findFinsihTdNtMembSetmealListPage(Map<String,Object> map);
    /**
     * @Purpose  根据用户id和套餐id查看用户是否有未完成的套餐
     * @version  1.0
     * @author   lizhun
     * @param    map
     * @return   TdNtMembSetmealList
     */
    public TdNtMembSetmealList findTdNtMembSetmealBymembId(Map<String,Integer> map);
    /**
     * @Purpose  根据资金变化id查找套餐
     * @version  1.0
     * @author   lizhun
     * @param    mfchg_id
     * @return   TdNtMembSetmealState
     */
    public TdNtMembSetmealState findTdNtMembSetmealState(Integer mfchg_id);
    /**
     * @Purpose  更新套餐状态
     * @version  1.0
     * @author   lizhun
     * @param    tdNtMembSetmealState
     * @return   TdNtMembSetmealState
     */
    public void udpateTdNtMembSetmealState(TdNtMembSetmealState tdNtMembSetmealState);
    /**
     * @Purpose  根据课程查找用户套餐信息
     * @version  1.0
     * @author   lizhun
     * @param    map
     * @return   TdNtMembSetmealDetail
     */
    public TdNtMembSetmealDetail findTdNtMembSetmealDetail(Map<String,Object> map);
    /**
     * @Purpose  更新套餐剩余时长
     * @version  1.0
     * @author   lizhun
     * @param    tdNtMembSetmealDetail
     * @return   void
     */
    public void updateTdNtMembSetmealDetail(TdNtMembSetmealDetail tdNtMembSetmealDetail);
    /**
     * @Purpose  根据课程查找用户套餐信息
     * @version  1.0
     * @author   lizhun
     * @param    map
     * @return   TdNtMembSetmealDetail
     */
    public TdNtMembSetmealDetail findTdNtMembSetmealDetailEnd(Map<String,Object> map);

    /**
     * @Purpose  根据用户id查找用户已购买完成的套餐信息
     * @version  4.1
     * @author   wangzheng
     * @param    memb_id
     * @return   List<TdNtMembSetmealDetail>
     */
    public List<TdNtMembSetmealDetail> findTdNtMembSetmealDetailByMembId(Integer memb_id);

    /**
     * @Purpose  根据用户和课程查找用户失效日期最早的套餐信息
     * @version  4.1
     * @author   wangzheng
     * @param    map
     * @return   TdNtMembSetmealDetail
     */
    public TdNtMembSetmealDetail findTdNtMembSetmealDetailEndByMembIdAndCouId(Map<String,Object> map);

    /**
     * @Purpose  更新用户购买的失效日期最早的套餐的剩余预约次数
     * @version  4.1
     * @author   wangzheng
     * @param    map
     * @return   void
     */
    public void updateTdNtMembSetmealDetailEnd(Map<String, Object> map);

    /**
     * @Purpose  更新用户购买的规格套餐的已上完课的次数
     * @version  4.1
     * @author   wangzheng
     * @param    map
     * @return   void
     */
    public void updateMembSetFinishedSize(Map<String, Object> map);


    /**
     * 根据支付记录id更新套餐支付状态
     *
     * @param mfchg_id
     * @param payState
     */
    public void updatePaymentStateByMfchgId(@Param("mfchg_id") int mfchg_id, @Param("payState") int payState);

    TdNtMembSetmealDetail fidById(int memb_set_id);

    /**
     * 判断用户是否购买过体验课或者1对1的课程
     * @param memb_id
     * @return
     */
    public List<TdNtSetMealIsTrial> selectSetmealIsTrial(@Param("memb_id")Integer memb_id);
}
